/*
 * @Author: xiaoMaiSui
 * @Date: 2023-05-10 10:40:48
 * @LastEditTime: 2023-05-10 14:24:53
 * @FilePath: \logger-master\lib\src\filters\development_filter.dart
 */
import '../log_filter.dart';
import '../logger.dart';

/// Prints all logs with `level >= Logger.level` while in development mode (eg
/// when `assert`s are evaluated, Flutter calls this debug mode).
///
/// In release mode ALL logs are omitted.
class DevelopmentFilter extends LogFilter {
//  [assert] are valid only when run in check mode, and are not executed if run in production mode
// assert(...)
  @override
  bool shouldLog(LogEvent event) {
    var shouldLog = false;
    assert(() {
      if (event.level.index >= level!.index) {
        shouldLog = true;
      }
      return true;
    }());
    return shouldLog;
  }
}
